with open(r'C:\Users\GY20240321\Desktop\a.txt', 'a', encoding='utf-8') as f:
    # f.write('你被我修改了')
    # print(f.read())
    f.write('你被我追加了')

with open(r'C:\Users\GY20240321\Desktop\b.txt', 'r', encoding='utf-8') as g:
    # print(g.readline())
    # print(g.readline())
    for i in g:
        print(i, end="")

# read()和 readline()读到文件末尾，返回一个空字符串
# with open('b.txt', encoding='utf-8') as f:
#     while True:
#         bug = g.readline()
#         if len(bug) == 0:
#             break
#         else:
#             print(bug, end='')
